<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        var num=1;
        function run1() {
            var img=document.getElementById("light");
            img.src=(++num==3?num=1:num)+".png";
            alert("keyi")
        }
    </script>
</head>
<body>
<img id="light" src="1.png" onclick="run1()">
</body>
</html>
